package com.htc.android.footprints.utils;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;

public class GpsFixStatus
{
  private static final String EXTRA_ENABLED = "enabled";
  private static final String GPS_ENABLED_CHANGE_ACTION = "android.location.GPS_ENABLED_CHANGE";
  private static final String GPS_FIX_CHANGE_ACTION = "android.location.GPS_FIX_CHANGE";
  private static final String TAG = "GpsFixStatus";
  private static GpsFixStatus mInstance = null;
  private boolean isFix = false;
  private Context mContext = null;
  private BroadcastReceiver mGpsReceiver = new BroadcastReceiver()
  {
    public void onReceive(Context paramContext, Intent paramIntent)
    {
      String str = paramIntent.getAction();
      if ((str.equals("android.location.GPS_ENABLED_CHANGE")) || (str.equals("android.location.GPS_FIX_CHANGE")))
        GpsFixStatus.this.updateGps(paramIntent);
    }
  };
  private FixListener mListener = null;

  public static GpsFixStatus getInstance(Context paramContext)
  {
    if (mInstance == null)
    {
      mInstance = new GpsFixStatus();
      mInstance.mContext = paramContext;
      mInstance.registerGpsReciver();
    }
    return mInstance;
  }

  private void registerGpsReciver()
  {
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("android.location.GPS_FIX_CHANGE");
    localIntentFilter.addAction("android.location.GPS_ENABLED_CHANGE");
    this.mContext.registerReceiver(this.mGpsReceiver, localIntentFilter);
  }

  private final void updateGps(Intent paramIntent)
  {
    String str = paramIntent.getAction();
    boolean bool = paramIntent.getBooleanExtra("enabled", false);
    if ((str.equals("android.location.GPS_FIX_CHANGE")) && (bool))
    {
      this.isFix = true;
      if (this.mListener != null)
        this.mListener.onFix();
      Log.i("GpsFixStatus", "GPS_FIX_CHANGE_ACTION");
    }
    while (true)
    {
      return;
      if ((str.equals("android.location.GPS_ENABLED_CHANGE")) && (!bool))
      {
        this.isFix = false;
        Log.i("GpsFixStatus", "GPS_ENABLED_CHANGE_ACTION_OFF");
        continue;
      }
      Log.i("GpsFixStatus", "GPS_ENABLED_CHANGE_ACTION_ON");
    }
  }

  public boolean isGpsFix()
  {
    return this.isFix;
  }

  public void removeGpsReciver()
  {
    this.mContext.unregisterReceiver(this.mGpsReceiver);
  }

  public void setFixListener(FixListener paramFixListener)
  {
    this.mListener = paramFixListener;
  }

  public static abstract interface FixListener
  {
    public abstract void onFix();
  }
}

/* Location:           E:\workspace\dex2java\dex-translator-0.0.9.3\HtcFootprints_dex2jar.jar
 * Qualified Name:     com.htc.android.footprints.utils.GpsFixStatus
 * JD-Core Version:    0.6.0
 */